module Cms
  class InputFragment < FieldFragment

    state_defined_by :data => 'Input text here?'

    def build
      e :span,
        :innerHTML => data,
        :class => 'f-static'

      e :input,
        :type => "text",
        :value => data,
        :class => 'f-editable'

      e :script, "
        dcat_instance.oninit(function(Y) {
          var fragment = new Cat.fragments.InputText(document.getElementById('#{id}'), #{options});
        });"
    end
  end
end